package com.jgp.sys.utils;

/**
 * 项目   jgp-cloud-parent
 * 作者   loufei
 * 时间   2019-09-11
 */
public enum  ColumnTypeEnum {
    VARCHAR("VARCHAR","java.lang.String"),
    VARCHAR2("VARCHAR2","java.lang.String"),
    BIGINIT("BIGINT","java.lang.Long"),
    INT("INT","java.lang.Integer"),
    TINYINT("TINYINT","java.lang.Integer"),
    NUMBER("NUMBER","java.lang.Double"),
    DATE("DATE","java.lang.String"),
    CHAR("CHAR","java.lang.String"),
    DATETIME("DATETIME","java.time.LocalDateTime"),
    TIMESTAMP("TIMESTAMP","java.time.LocalDateTime");
    
    private String dbType;
    private String javaType;
    
    ColumnTypeEnum(String dbType,String javaType){
        this.dbType = dbType;
        this.javaType = javaType;
    }
    
    public static String getColumnTypeEnumByDBType(String dbType){
        for(ColumnTypeEnum columnTypeEnum:ColumnTypeEnum.values()){
            if(columnTypeEnum.getDbType().equals(dbType)){
                return columnTypeEnum.getJavaType();
            }
        }
        return "";
    }
    
    public String getDbType() {
        return dbType;
    }
    
    public void setDbType(String dbType) {
        this.dbType = dbType;
    }
    
    public String getJavaType() {
        return javaType;
    }
    
    public void setJavaType(String javaType) {
        this.javaType = javaType;
    }
}
